package jwt.duplo.game.core{
	import flash.display.Sprite;
	import flash.events.Event;
	
	import jwt.duplo.game.core.IGameEngine;
	
	/**
	 * Base Class for all dupplo games implemteing IGameEngine to tie in with the website. 
	 * @author pwolleb
	 * 
	 */	
	public class GameEngine extends Sprite implements IGameEngine {
		
		protected var _score:Number;
		
		public function startup():void {
			_score = 0;
		}
		
		public function shutdown():void {
			// Destroy
			if(hasEventListener(Event.ENTER_FRAME)) pause();
		}
		
		public function play():void {
			// Start rendering and listening to user input
			addEventListener(Event.ENTER_FRAME, render);
		}
		
		protected function render(e:Event):void {
			// Do rendering
		}
		
		public function pause():void {
			// Pause rendering and listening to user input
			removeEventListener(Event.ENTER_FRAME, render);
		}
		
		public function get score():Number {
			return _score;
		}
		
		public function resize(width:int, height:int):void {
			
		}
	}
}